<!DOCTYPE html>
<html lang="en">
<title>订单管理</title>
<#import "/layout/layout.html" as body/>
<@body.page>

<style>
    a {
        color: #666;
    }
    .tcdPageCode {
        padding: 15px 20px;
        text-align: left;
        color: #ccc;
    }
    .tcdPageCode a {
        display: inline-block;
        color: #428bca;
        height: 25px;
        line-height: 25px;
        padding: 0 10px;
        border: 1px solid #ddd;
        margin: 0 2px;
        border-radius: 4px;
        vertical-align: middle;
    }
    .tcdPageCode a:hover {
        text-decoration: none;
        border: 1px solid #428bca;
    }
    .tcdPageCode span.current {
        display: inline-block;
        height: 25px;
        line-height: 25px;
        padding: 0 10px;
        margin: 0 2px;
        color: #fff;
        background-color: #428bca;
        border: 1px solid #428bca;
        border-radius: 4px;
        vertical-align: middle;
    }
    .tcdPageCode span.disabled {
        display: inline-block;
        height: 25px;
        line-height: 25px;
        padding: 0 10px;
        margin: 0 2px;
        color: #bfbfbf;
        background: #f2f2f2;
        border: 1px solid #bfbfbf;
        border-radius: 4px;
        vertical-align: middle;
    }
    .chosen-container {
        min-width: 160px !important;
    }
    .modal-loading { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; background: rgba(0, 0, 0, .5) url("${baseUrl}img/loading.gif") no-repeat center; }
</style>
<div class="modal-loading"></div>
<!--<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2 id="order_id">订单管理</h2>
        <ol class="breadcrumb" id="order_top">
            <li><a href="${baseUrl}system/to_index">首页</a></li>
            <li class="active"><a href="to_order_list">订单管理</a></li>
            <li class="active" id="order_title"><strong>团体课程</strong></li>
        </ol>
    </div>
</div>-->
<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-lg-12 margin-top">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">团体课程订单</h5>
                    <!--<button type="button" class="btn btn-primary btn-sm pull-right">导出表格</button>-->
                </div>
                <div class="ibox-content">

                    <ul class="nav navbar-nav status-nav" id="ul_id">
                        <li class="active"><a href="#">已支付待开始</a></li>
                        <li><a href="#">已支付排队中</a></li>
                        <li><a href="#">已结束</a></li>
                        <li><a href="#">主动取消</a></li>
                        <li><a href="#">被动取消</a></li>
                        <li><a href="#">待支付</a></li>
                        <li><a href="#">已退款</a></li>
                    </ul>
                    <div class="wrapper wrapper-content animated fadeInRight">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="ibox float-e-margins">
                                    <!-- <div class="ibox-title">
                                        <h5 id="">已支付待开始</h5>
                                    </div> -->
                                    <div class="ibox-content">
                                        <form class="form-inline" role="form" action="" role="form" id="form" method="post" accept-charset="UTF-8">
                                            <div class="form-group margin-left">
                                                <label for="tk_tradeId">订单号：</label>
                                                <input class="form-control" id="tk_tradeId" name="tk_tradeId" type="text" placeholder="订单号" value=""/>
                                            </div>
                                            <div class="form-group date-rangepicker">
                                                <label for="daterange">日期：</label>
                                                <input class="form-control" id="tk_time" type="text" name="daterange" value="" style="width: 188px"/>
                                            </div>
                                            <div class="form-group margin-left">
                                                <label for="daterange1">课程：</label>
                                                <input class="form-control" id="tk_course" type="text" style="width:120px" placeholder="请输入课程ID"/>
                                            </div>
                                            <div class="form-group margin-left" id="" style="">
                                                <label>教练：</label>
                                            </div>
                                            <div class="form-group margin-left" style="">
                                                <select data-placeholder="请输入教练" class="chosen-select coach_list" style="width:80%;" tabindex="2" id="tk_coach_list">
                                                    <option value="0">全部</option>
                                                </select>
                                            </div>
                                            <div class="form-group margin-left">
                                                <label for="daterange2">用户：</label>
                                                <input class="form-control" id="tk_mobile" type="text" style="width:150px" placeholder="请输入用户手机号"/>
                                            </div>
                                            <div class="form-group margin-left">
                                                <label for="daterange2">用户ID：</label>
                                                <input class="form-control" id="tk_userId" name="tk_userId" type="text" style="width:150px" placeholder="请输入用户手机号"/>
                                            </div>
                                            <div class="form-group margin-left">
                                                <label for="daterange2">用户昵称：</label>
                                                <input class="form-control" id="tk_userName" name="tk_userName" type="text" style="width:150px" placeholder="请输入用户手机号"/>
                                            </div>
                                            <div class="form-group margin-left" id="" style="">
                                                <label>门店：</label>
                                            </div>
                                            <div class="form-group margin-left" style="">
                                                <select data-placeholder="请输入门店" class="chosen-select store_list" style="width:80%;" tabindex="2" id="tk_store_list">
                                                    <option value="0">全部</option>
                                                </select>
                                            </div>
                                            <button type="button" class="btn btn-outline btn-primary" style="margin-top: 5px" id="but_submit">确认</button>
                                            <div class="form-group margin-right" style="">
                                                <button type="button" class="btn btn-outline excelButton" style="margin-top: 5px" id="tk_export" onclick="tkExport(1)">导出</button>
                                            </div>

                                        </form>
                                        <hr>
                                        <div class="table-responsive">
                                            <!-- dataTables-example -->
                                            <table class="table table-hover table-center dataTables-example">
                                                <thead>
                                                <tr>
                                                    <th>序号</th>
                                                    <th>交易编号</th>
                                                    <th id="tk_th">下订单时间</th>
                                                    <th>订单号</th>
                                                    <th>课程名称</th>
                                                    <th>开课时间</th>
                                                    <th>教练</th>
                                                    <th>用户</th>
                                                    <th>身份</th>
                                                    <th>费用</th>
                                                    <th>优惠券</th>
                                                    <th>购买人数</th>
                                                    <th>实付</th>
                                                    <th>门店</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <!-- 页面加载的数据  -->
                                                <tbody id="td1">
                                                </tfoot>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="ibox-footer overflow" id="tk_dibu">
                                        <h4 class="pull-left margin-left" id="tk_tongji" style="color: #2fb146">订单合计：0笔</h4>
                                        <h4 class="pull-left margin-left" id="tk_feiyong" style="color: #2fb146">费用合计：¥0</h4>
                                        <h4 class="pull-left" id="tk_shifu" style="color: #2fb146">实付合计：¥0</h4>
                                        <div class="pull-right copot-page" id="tk_page_list"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<!-- mode start -->
<input type="hidden" id="click_order_type" value="团体课程">
<input type="hidden" id="order_type_child" value="1">
<input type="hidden" id="baseUrl" value="${baseUrl}">
<!-- mode end  -->
<link href="${baseUrl}css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<script src="${baseUrl}js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" src="${baseUrl}js/order/orderInfo.js"></script>
<script src="https://cdn.bootcss.com/bootstrap-modal/2.2.6/js/bootstrap-modal.js"></script>
<script>
    /*function fnClickAddRow() {
     $('#editable').dataTable().fnAddData(["Custom row", "New row", "New row", "New row", "New row"]);
     }*/
    $(document).ready(function () {

        //时间选择
        $('input[name="daterange"]').daterangepicker({
            startDate: moment().startOf('day'),
            endDate: moment(),
            //minDate: '01/01/2012',    //最小时间
            //maxDate: moment(), //最大时间
            dateLimit: {days: 365}, //起止时间的最大间隔
            showDropdowns: true,
            showWeekNumbers: false, //是否显示第几周
            timePicker: false, //是否显示小时和分钟
            timePickerIncrement: 60, //时间的增量，单位为分钟
            timePicker12Hour: false, //是否使用12小时制来显示时间
            ranges: {
                //'最近1小时': [moment().subtract('hours',1), moment()],
                '今日': [moment().startOf('day'), moment()],
                '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
                '最近7日': [moment().subtract('days', 6), moment()],
                '最近30日': [moment().subtract('days', 365), moment()]
            },
            opens: 'right', //日期选择框的弹出位置
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary blue',
            cancelClass: 'btn-small',
            format: 'YYYY-MM-DD', //控件中from和to 显示的日期格式 YYYY-MM-DD HH:mm:ss
            separator: '~',
            locale: {
                applyLabel: '确定',
                cancelLabel: '取消',
                fromLabel: '起始时间',
                toLabel: '结束时间',
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            }
        }, function (start, end, label) {//格式化日期显示框
            $('.date-rangepicker span').html(start.format('YYYY-MM-DD HH:mm:ss') + ' - ' + end.format('YYYY-MM-DD HH:mm:ss'));
        });

        $("#btn_tuikuan").click(function () {
            var orderNumber = $("#orderNumber").val();
            swal({
                title: "确定退款\n订单号:" + orderNumber,
                text: "退款之后金额直接打入对方账户!",
                type: "warning",
                showCancelButton: true,
                cancelButtonText: "容我三思！",
                confirmButtonText: "确定!",
            }).then(function () {
                $.ajax({
                    url: "admin_createdRefun",
                    data: {
                        "orderNumber": orderNumber,
                        "biaoshi": 1
                    },
                    type: 'post',
                    cache: false,
                    dataType: 'json',
                    success: function (data) {
                        if (data.ret == -1) {
                            swal("退款失败!", data.msg, "error");
                        } else {
                            $("#orderNumber").val("");
                            swal("退款成功", "金额已达到对方账户", "success");
                            window.setTimeout(function () {
                            }, 1000);
                        }
                    },
                    error: function () {
                        swal("退款失败!", "请联系管理员处理", "error");
                    }
                });

            }, function () {
            });
        });

    });

</script>

</@body.page>
</html>